<template>
    <div class="customer vipCard">

        <el-row style="margin-top: 15px;padding: 20px 0;">
            <el-col :span="24">
                <el-button  @click="goBack()" type="primary" >返回</el-button>
				
               <!--  <el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="100px">
                    <el-form-item>
                        <el-select v-model="formInline.type" style="width: 120px;" @change="changeType">
                            <el-option label="按账号" value="phone"></el-option>
                            <el-option label="按真实姓名" value="realName"></el-option>
                        </el-select>
                        <el-input v-model="formInline.name" style="width: 150px;"></el-input>
                    </el-form-item>
                    <el-button type="primary" @click="fetchData()">查询</el-button>
                     
                </el-form> -->
				<div style="display: flex;justify-content: flex-start;margin-top: 15px;">
					<p @click="handleClick(1)" :class="activeName== 1? 'newTabHeader':'tabHeader'">外卖商城</p>
					<p @click="handleClick(2)" :class="activeName== 2? 'newTabHeader':'tabHeader'">代金券</p>
					<p @click="handleClick(3)" :class="activeName== 3? 'newTabHeader':'tabHeader'">会员卡</p>
				</div>
                <!-- <el-tabs v-model="activeName" type="card" @tab-click="handleClick" style="margin-top: 20px;">
                    <el-tab-pane :label="'外卖商城'" name="1"></el-tab-pane>
                    <el-tab-pane :label="'代金券'" name="2"></el-tab-pane>
					<el-tab-pane :label="'会员卡'" name="3"></el-tab-pane>
                 </el-tabs> -->
            </el-col>
        </el-row>
		<div v-show="activeName==1" style="border: 1px solid #949494;margin-bottom: 15px;">
			<div style="border-bottom: 1px solid #949494;color: #48576a;">
				<p style="font-size: 14px;width: 100px;text-align: right;padding: 10px 18px 10px 0;margin: 0;font-weight: 600;">商品管理</p>
			</div>
			<div style="padding-top: 15px;">
				<el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="100px" >
				    <el-form-item label="商品名称:">
				        <el-input v-model="formInline.goodName" style="width: 150px;" :maxlength="50"></el-input>
				    </el-form-item>
				    <el-form-item label="按状态：">
				        <el-select v-model="formInline.goodState" style="width: 120px;" >
				            <el-option label="全部" value=""></el-option>
				            <el-option label="已上架" value="2" ></el-option>
				            <el-option label="商家下架" value="3" ></el-option>
				            <el-option label="官方下架" value="6" ></el-option>
				        </el-select>
				    </el-form-item>
				    <el-form-item label="按分类：">
				        <el-select v-model="formInline.goodOneCate" style="width: 150px;"  @change="selectSort2()"
				               placeholder="一级分类">
				                <el-option label="全部" value=""></el-option>
				                <el-option :label="item.cateName" :value="item.cateId"
				                   v-for="item in sortList"></el-option>
				        </el-select>
				        <el-select v-model="formInline.goodTwoCate" style="width: 150px;" placeholder="二级分类" v-if="formInline.goodOneCate">
				               <el-option label="全部" value=""></el-option>
				               <el-option :label="item.cateName" :value="item.cateId"
				                       v-for="item in secondList"></el-option>
				        </el-select>
				    </el-form-item>
				    <el-form-item label="是否启用优惠价：" label-width="130px">
				        <el-select v-model="formInline.goodIsDiscount" style="width: 120px;" >
				            <el-option label="全部" value=""></el-option>
				            <el-option label="已启用" value="1" ></el-option>
				            <el-option label="未启用" value="2" ></el-option>
				        </el-select>
				    </el-form-item>
				    <el-button type="primary" @click="fetchData(1)">查询</el-button>
				
				</el-form>
			</div>
		</div>
        
        <el-table
                :data="pageInfo.dtos"
                v-loading="table_loading"
                element-table_loading-text="加载中"
                stripe
                @sort-change='order'
                v-show="activeName==1"
                style="width: 100%">
            <el-table-column
                    type="index"
                    width="80"
                    label="序号">
            </el-table-column>
            <el-table-column
                    width="215"
                    label="商品">
                <template scope="scope">
                    <div style="display: inline-block;">
                        <img class="banner" :src="scope.row.goodCover" style="width:55px;">
                    </div>
                    <div style="display: inline-block;width: 120px;vertical-align: middle;padding: 10px;">{{scope.row.goodName}}</div>
                </template>
            </el-table-column>
            <el-table-column
                    prop="DIS_PRICE"
                    label="分类">
                    <template scope="scope">
                        <span>{{ scope.row.goodOneCateName }} - {{ scope.row.goodTwoCateName }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="good_Price"
                    sortable='custom'
                    label="起售价（元）">
                    <template scope="scope">
                        <span>{{ scope.row.goodPrice }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="T1.good_Discount_Price"
                    label="优惠价（元）">
                    <template scope="scope">
                        <span v-if="scope.row.goodIsDiscount==1">{{ scope.row.goodDiscountPrice }}</span>
                        <span v-else>未启用</span>
                    </template>
            </el-table-column>
<!--            <el-table-column
                     prop="good_Ratio"
                    label="补贴比例">
                    <template scope="scope">
                          <span>{{ scope.row.goodRatio*100 }}%</span>
                    </template>
            </el-table-column> -->
            <el-table-column
                     prop="sales"
                     label="销量">
            </el-table-column>
            <el-table-column
                    label="库存">
					<template scope="scope">
					    <span>不限库存</span>
					</template>
            </el-table-column>
            <el-table-column
                    prop="cre_Time"
                    sortable='custom'
                    label="上架时间">
                    <template scope="scope">
                        <span>{{scope.row.creTime}}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="stock"
                    label="评价">
                    <template scope="scope">
                        <el-button type="primary" size="small" @click="check(scope.row.goodId)">查看</el-button>
                    </template>
            </el-table-column>
            <el-table-column label="操作" width="140">
                <template scope="scope">
                    <el-button type="primary" size="small" @click="goodDetail(scope.row.goodId)">编辑</el-button>
                    <el-button type="danger" size="small"
                               @click="handleDelete(scope.row,'下架')" v-if="scope.row.goodState==2">下架
                    </el-button>
                    <el-button type="success" size="small"
                               @click="handleDelete(scope.row,'上架')" v-else>上架
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="paginate" v-show="activeName==1">
            <el-pagination
                    @current-change="handleCurrentChange"
                    :current-page="pageInfo.pageNum"
                    :page-size="pageInfo.pageSize"
                    layout="total, prev, pager, next, jumper"
                    :total="pageInfo.count"
                    >
            </el-pagination>
        </div>

        <!--代金券table-->
		<div v-show="activeName==2" style="border: 1px solid #949494;margin-bottom: 15px;">
			<div style="border-bottom: 1px solid #949494;color: #48576a;">
				<p style="font-size: 14px;width: 120px;text-align: right;padding: 10px 18px 10px 0;margin: 0;font-weight: 600;">代金券管理</p>
			</div>
			<div style="padding-top: 15px;">
				<el-form :inline="true" :model="formInline2" class="demo-form-inline" label-width="120px" >
				    <el-form-item label="代金券名称:">
				        <el-input v-model="formInline2.voucherName" style="width: 150px;" :maxlength="50"></el-input>
				    </el-form-item>
				    <el-form-item label="按状态：">
				        <el-select v-model="formInline2.voucherStat" style="width: 120px;" >
				            <el-option label="全部" value=""></el-option>
				            <el-option :label="item.text" :value="item.value" v-for="item in statList"></el-option>
				        </el-select>
				    </el-form-item>
				    <el-button type="primary" @click="fetchData2(1)">查询</el-button>
				
				</el-form>
			</div>
		</div>
		
        
        <el-table
                :data="pageInfo2.dtos"
                v-loading="table_loading"
                element-table_loading-text="加载中"
                stripe
                @sort-change='order2'
                v-show="activeName==2"
                style="width: 100%">
            <el-table-column
                    type="index"
                    width="80"
                    label="序号">
            </el-table-column>
            <el-table-column
                    label="封面">
                    <template scope="scope">
                        <img class="avatar" :src="scope.row.voucherCover" style="width: 55px;height: 55px;border-radius: 0;">
                    </template>
            </el-table-column>
            <el-table-column
                    prop="voucherName"
                    label="代金券名称">
            </el-table-column>
            <el-table-column
                    sortable='custom'
                    prop="voucher_Amt"
                    label="价格">
                    <template scope="scope">
                        <span>{{ scope.row.voucherAmt }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="voucherSunNum"
                    label="销量">
            </el-table-column>
            <el-table-column
                    prop="voucherNum"
                    label="库存">
            </el-table-column>
            <el-table-column
                    sortable='custom'
                    label="有效期">
                    <template scope="scope">
                        <span>{{ scope.row.voucherStartTime }}-{{ scope.row.voucherEndTime }}</span>
                    </template>
            </el-table-column>
            <el-table-column
                    prop="normalState"
                    label="状态">
                    <template scope="scope">
                        <span>{{statList[scope.row.voucherStat].text}}</span>
                    </template>
            </el-table-column>
            <el-table-column label="操作" width="140">
                <template scope="scope">
                    <el-button type="primary" size="small" @click="voucherDetail(scope.row.voucherId)">查看</el-button>
                    <el-button type="danger" size="small"  v-if="scope.row.voucherStat==1"
                               @click="handleDelete2(scope.row,'禁用')">禁用
                    </el-button>
                    <el-button type="success" size="small" v-else
                               @click="handleDelete2(scope.row,'启用')">启用
                    </el-button> 
                </template>
            </el-table-column>
        </el-table>
        <div class="paginate" v-show="activeName==2">
            <el-pagination
                    @current-change="handleCurrentChange"
                    :current-page="pageInfo2.pageNum"
                    :page-size="pageInfo2.pageSize"
                    layout="total, prev, pager, next, jumper"
                    :total="pageInfo2.count"
                    >
            </el-pagination>
        </div>
		
		<!-- 会员卡table -->
		<div v-show="activeName==3" style="border: 1px solid #949494;margin-bottom: 15px;">
			<div style="border-bottom: 1px solid #949494;color: #48576a;">
				<p style="font-size: 14px;width: 120px;text-align: right;padding: 10px 18px 10px 0;margin: 0;font-weight: 600;">会员卡管理</p>
			</div>
			<div style="padding-top: 15px;">
				<el-form :inline="true" :model="formInline4" class="demo-form-inline" label-width="120px" >
				    <el-form-item label="会员卡状态:">
				        <el-select v-model="formInline4.voucherStat" style="width: 120px;" >
				            <el-option label="全部" value=""></el-option>
				            <el-option :label="item.text" :value="item.value" v-for="item in vipCardList"></el-option>
				        </el-select>
				    </el-form-item>
				    <el-button type="primary" @click="fetchData4(1)">查询</el-button>
					<el-button  type="primary" @click="findCardList()">会员卡名单</el-button>
					<!-- <el-button type="primary" @click="findPayCardList()">会员卡购买记录</el-button> -->
				</el-form>
			</div>
		</div>
				<el-table
				        :data="pageInfo4.lists"
				        v-loading="table_loading"
				        element-table_loading-text="加载中"
				        stripe
				        v-show="activeName==3"
				        style="width: 100%">
				    <el-table-column
				            type="index"
				            width="80"
				            label="序号">
				    </el-table-column>
				
				    <el-table-column
				            prop="voucherName"
				            label="卡片名称">
				    </el-table-column>
					<el-table-column
					        label="会员卡封面">
					        <template scope="scope">
					            <img class="avatar" :src="scope.row.voucherCover" style="width: 100px;border-radius: 5px;margin: 5px 0;">
					        </template>
					</el-table-column>
				    <el-table-column
				            prop="balance"
				            label="卡片面值(元)">
				    </el-table-column>
				    <el-table-column
				            prop="voucherAmt"
				            label="卡片售价(元)">
				    </el-table-column>
				    <el-table-column
				            prop="voucherNum"
				            label="库存数量">
				    </el-table-column>
					<el-table-column
					prop="voucherSunNum"
					        label="销量">
					</el-table-column>
					<el-table-column
					        label="补贴比例">
							<template scope="scope">
							   	<span>{{ scope.row.rate*100 }}%</span>
							</template>
					</el-table-column>
				    
				    <el-table-column
				            prop="normalState"
				            label="状态">
				            <template scope="scope">
				                <span>{{vipCardList[scope.row.voucherStat].text}}</span>
				            </template>
				    </el-table-column>
				    <el-table-column label="操作" width="140">
				        <template scope="scope">
				            <el-button type="primary" size="small" @click="showCardDiog(scope.row)">查看</el-button>
				           <el-button type="danger" size="small"  v-if="scope.row.voucherStat==1"
				                       @click="handleDelete3(scope.row,'下架')">下架
				            </el-button>
				            <el-button type="success" size="small" v-else
				                       @click="handleDelete3(scope.row,'上架')">上架
				            </el-button>
				        </template>
				    </el-table-column>
				</el-table>
				<div class="paginate" v-show="activeName==3">
				    <el-pagination
				            @current-change="handleCurrentChange"
				            :current-page="pageInfo4.pageNum"
				            :page-size="pageInfo4.pageSize"
				            layout="total, prev, pager, next, jumper"
				            :total="pageInfo4.count"
				            >
				    </el-pagination>
				</div>
				
				<div>
					
					<!-- 查看会员卡 -->
					<el-dialog
					  title="查看会员卡"
					  :visible.sync="dialogFindVipVisible"
					  :before-close="handleClose"
					  width="30%"
					  center="true">
					  <el-tabs v-model="activeCardName"  style="margin-top: 20px;">
					      <el-tab-pane :label="'会员卡信息'" name="1"></el-tab-pane>
					      <el-tab-pane :label="'其他信息'" name="2"></el-tab-pane>
					   </el-tabs>
					   <div style="padding: 0 40px 0 20px;">
						   <el-form  :model="formInlineCard"  class="demo-form-inline" label-width="120px" v-show="activeCardName==1">
										<el-form-item label="会员卡名称：">
										   <el-input v-model="formInlineCard.voucherName"></el-input>
										</el-form-item>
						   				<el-form-item label="会员卡封面：">
						   				  <div >
						   				  	<we-ui-uploads :images="formInlineCard.voucherCover" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
						   				  </div>
						   				</el-form-item>
										<el-form-item label="会员卡logo：">
										  <div >
										  	<we-ui-uploads :images="formInlineCard.logo" :maxCount="1" :maxSize="1024*1024" @uploading="uploading4"></we-ui-uploads>
										  </div>
										</el-form-item>
						   				<el-form-item label="卡片面值：">
						   				   <el-input v-model="formInlineCard.balance" ></el-input>
						   				</el-form-item>
						   				<el-form-item label="卡片售价：">
						   				   <el-input v-model="formInlineCard.voucherAmt" ></el-input>
						   				</el-form-item>
						   				<el-form-item label="有效日期：">
											<el-input v-model="endDaTE" readonly></el-input>
						   				</el-form-item>
						   				<el-form-item label="库存数量：">
						   				   <el-input v-model="formInlineCard.voucherNum" ></el-input>
						   				</el-form-item>
						   				<el-form-item label="特权说明：">
						   				    <el-input v-model="formInlineCard.voucherRemark" :maxlength="120"  type="textarea" :rows="3"></el-input>
						   				</el-form-item>
						   				<el-form-item label="使用须知：">
						   				   <el-input v-model="formInlineCard.voucherUseRule" :maxlength="120"  type="textarea" :rows="3"></el-input>
						   				</el-form-item>
						   </el-form>
						   
						   <el-form  :model="formInlineCard"  class="demo-form-inline" label-width="120px" v-show="activeCardName==2">
						   							<el-form-item label="创建时间：">
						   							   <el-input v-model="formInlineCard.creTime" readonly></el-input>
						   							</el-form-item>
						   				<el-form-item label="销量：">
						   				   <el-input v-model="formInlineCard.voucherSunNum" readonly></el-input>
						   				</el-form-item>
						   				<el-form-item label="会员卡状态：">
						   				   <el-select v-model="formInlineCard.voucherStat" style="width: 192px;" >
						   				       <el-option label="全部" value=""></el-option>
						   				       <el-option :label="item.text" :value="item.value" v-for="item in vipCardList"></el-option>
						   				   </el-select>
						   				</el-form-item>
						   				<el-form-item label="补贴比例：">
						   				   <el-select v-model="formInlineCard.rate" style="width: 192px;margin-right: 30px;">
						   				       <el-option :label="item.text" :value="item.value" v-for="item in scalePublicData"></el-option>
						   				   </el-select>
						   				</el-form-item>
						   </el-form>
					   </div>
					  <span slot="footer" class="dialog-footer">
							<el-button type="primary" @click="cardSubmit()">确 定</el-button>
							<el-button @click="dialogFindVipVisible = false">取 消</el-button>
					  </span>
					</el-dialog>

				
				</div>
				
        <el-dialog title="查看评价" v-model="dialogVisible"  size="large">
            <el-table
                    :data="pageInfo3.dtos"
                    element-table_loading-text="加载中"
                    stripe
                    v-loading="table_loading2"
                    style="width: 100%">
                <el-table-column
                        label="用户名"
                        prop="userName">
                </el-table-column>
                <el-table-column
                        label="星级评分"
                        prop="userName">
                        <template scope="scope">
                            <span>{{ scope.row.evaluateStar }}星</span>
                        </template>
                </el-table-column>
                <el-table-column
                        label="评价内容"
                        prop="evaluateContent">
                </el-table-column>
                <el-table-column
                        label="图片"
                        prop="territorial_Limit">
                        <template scope="scope">
                                <img :src="item" alt="" v-for="item in scope.row.evaluateImage" class="img-preview" @click="previewImage(item)" style="margin-right: 10px;width:60px;height: 60px;">
                                <span v-if="scope.row.evaluateImage==''">无</span>
                        </template>
                </el-table-column>
                <el-table-column
                        label="评价时间"
                        prop="evaluateTime">
                </el-table-column>
            </el-table>
            <div class="paginate">
                <el-pagination
                        @current-change="handleCurrentChange2"
                        :current-page="pageInfo3.pageNum"
                        :page-size="pageInfo3.pageSize"
                        layout="total, prev, pager, next, jumper"
                        :total="pageInfo3.count"
                        >
                </el-pagination>
            </div>
        </el-dialog>  
		
		<div class="cardDialeg">
			<el-dialog
			  title="会员卡名单"
			  :visible.sync="dialogVisibleAll"
			  :before-close="handleClose"
			  center="true">
			   <div style="padding: 0 20px;">
				<el-table
				        :data="pageInfo5.dtos"
				        v-loading="tableCard_loading"
				        element-table_loading-text="加载中"
				        style="width: 100%">
				    <el-table-column
				            label="用户Id"
							prop="userId">
				    </el-table-column>
				    <el-table-column
				            prop="name"
				            label="用户名">
				    </el-table-column>
				    <el-table-column
				            prop="phone"
				            label="手机号">
				    </el-table-column>
					<el-table-column
					        prop="voucherId"
					        label="会员卡号">
					</el-table-column>
				    <el-table-column
				            prop="voucherName"
				            label="会员卡名称">
				    </el-table-column>
				    <el-table-column
				            prop="userName"
				            label="会员卡绑定姓名">
				    </el-table-column>
				    <el-table-column
				            prop='userPhone'
				            label="会员卡绑定手机号">
				    </el-table-column>
				    <el-table-column
				            prop="balance"
				            label="会员卡余额">
				    </el-table-column>
				</el-table>
				<div class="paginate">
				    <el-pagination
				            @current-change="handleCurrentChangeCard"
				            :current-page="pageInfo5.pageNum"
				            :page-size="pageInfo5.pageSize"
				            layout="total, prev, pager, next, jumper"
				            :total="pageInfo5.count"
				            >
				    </el-pagination>
				</div>
			   </div>
			</el-dialog>
		</div>
		    
		
				<!-- 会员卡购买记录 -->
				<div class="cardDialeg">
					<el-dialog title="会员卡名单" :visible.sync="dialogVisiblePayHistory" :before-close="handleClose" center="true">
						<div style="padding: 0 20px;">
							<el-table :data="pageInfoPay.dtos" v-loading="tableCard_loading" element-table_loading-text="加载中" style="width: 100%">
								<el-table-column
								        prop="voucherName"
								        label="卡片名称">
								</el-table-column>
								<el-table-column
								        label="会员卡封面">
								        <template scope="scope">
								            <img class="avatar" :src="scope.row.voucherCover" style="width: 100px;border-radius: 5px;margin: 5px 0;">
								        </template>
								</el-table-column>
								<el-table-column
								        prop="voucherAmt"
								        label="卡片售价(元)">
								</el-table-column>
								<el-table-column
								        prop="voucherNum"
								        label="库存数量">
								</el-table-column>
								<el-table-column
								prop="voucherSunNum"
								        label="销量">
								</el-table-column>
								
							</el-table>
							<div class="paginate">
								<el-pagination @current-change="handleCurrentChangePay" :current-page="pageInfoPay.pageNum" :page-size="pageInfoPay.pageSize"
								 layout="total, prev, pager, next, jumper" :total="pageInfoPay.count">
								</el-pagination>
							</div>
						</div>
					</el-dialog>
				</div>
		
        <div class="weui-gallery" style="display: block;z-index: 9999;" v-show="img.is_preview" >
            <span class="weui-gallery__img" :style="{backgroundImage:img.preview_url,transform:img.transform}" @click="hidePreview"></span>
            <div class="weui-gallery__opr white_pointer">
                <div  class="weui-gallery__del" @click.prevent="rotate()">
                    <img src="../../assets/images/xuanzhuan.png" height="25" width="25">
                    <span class="weui-span_del">旋转</span>
                </div>
            </div>
        </div>
    
	</div>

</template>
<style>
.vipCard .el-tabs__item{
    font-size:18px !important;
	color: #222222;
	font-weight: 500;
}
.el-tabs__item.is-active{
	color: #0082E6;
}
.vipCard .el-tabs__header{
  border-bottom:none;
}
.vipCard .el-dialog__header{
	text-align: center;
	background-color: #f4f5f6;
	padding: 20px;
}
.vipCard .el-dialog__body{
	padding: 0;
}
.vipCard .el-dialog--small{
	width: 30%;
}
.cardDialeg .el-dialog--small{
	width: 70%;
}
.vipCard .el-form-item {
	margin-bottom: 10px;
}
.weui-uploader__files img{
	width: 100px!important;
	height: auto!important;
}
	.tabHeader {
		width: 120px;
		text-align: center;
		display: inline-block;
		padding: 5px 10px;
		margin: 0;
		border: 1px solid #909399;
		border-right: 0;
		cursor: pointer;
		font-size: 18px;
	}
	.newTabHeader{
		width: 120px;
		text-align: center;
		display: inline-block;
		font-size: 18px;
		padding: 5px 10px;
		margin: 0;
		border: 1px solid #909399;
		border-right: 0;
		cursor: pointer;
		color: #409eff;
	}
	.newTabHeader:last-child {
			width: 120px;
			text-align: center;
			display: inline-block;
			padding: 5px 10px;
			margin: 0;
			border: 1px solid #909399;
			font-size: 18px;
		}
	.tabHeader:last-child {
		width: 120px;
		text-align: center;
		display: inline-block;
		padding: 5px 10px;
		margin: 0;
		border: 1px solid #909399;
		font-size: 18px;
	}
</style>
<script>
    export default {
        data() {
            return {
                title: '用户列表',
                table_loading: false,
                table_loading2: false,
                pageInfo: {
                    pageNum: 1,
                    pageSize: 1,
                    count: 1,
                    dtos:[]
                },
                formInline: {
                    goodsName:'',
                    goodOneCate:'',
                    goodTwoCate:'',
                    goodState:'',
                    storeId:'',
					goodIdent: "2",
                    pageNum:1,
                    pageSize:10,
                    sort:'T1.CRE_TIME',
                    desc:'DESC',
                    goodIsDiscount:''
                },
                formInline2: {
                    pageNum:1,
                    sort:'VOUCHER_AMT',
                    desc:'DESC',
                    pageSize:10,
                    storeId:'',
                    voucherType:'1',
                    voucherName:'',
                    voucherStat:'',
                    storeId:''
                },
                pageInfo2: {
                    pageNum: 1,
                    pageSize: 1,
                    count: 1,
                    dtos:[]
                },
                pageInfo3: {
                    pageNum: 1,
                    pageSize: 5,
                    count: 1,
                    dtos: []
                },
				formInline4: {
				    pageNum:1,
				    sort:'VOUCHER_AMT',
					voucherType:'3',
				    desc:'DESC',
				    pageSize:10,
				    type:'3',
				    storeId:''
				},
				pageInfo4: {
				    pageNum: 1,
				    pageSize: 1,
				    count: 1,
				    dtos:[]
				},
                formLabelWidth: '120px',
                loading:false,
                activeName: '1',
                sortList:[],
                secondList:[],
                showSort:false,
                storeId:'',
                statList:[{ text: '商家禁用', value: '0' },{ text: '已启用', value: '1' },{ text: '平台禁用', value: '2' }],
                dialogVisible:false,
				dialogVisiblePayHistory: false,
				formInlinePay: {
					pageNum: 1,
					sort: 'VOUCHER_AMT',
					desc: 'DESC',
					pageSize: 10,
					storeId: '',
					voucherType: '3',
					voucherName: '',
					voucherStat: '',
					storeId: ''
				},
				pageInfoPay: {
					pageNum: 1,
					pageSize: 1,
					count: 1,
					dtos: []
				},
                id:'',
                 img: {
                    is_preview: false,
                    preview_url: '',
                    image_index: null,
                    preview_images: [],
                    transform:''
                },
				vipCardList: [
					{ text: '已下架', value: '0' },
					{ text: '出售中', value: '1' },
					{ text: '已失效', value: '2' }
				],
				dialogFindVipVisible: false,
				dialogVisibleAll: false,
				formInlineCard: {},
				proportion: [{
						text: '2%',
						value: 0.02
					}, {
						text: '4%',
						value: 0.04
					}, {
						text: '6%',
						value: 0.06
					},
					{
						text: '8%',
						value: 0.08
					}
				],
				activeCardName: '1',
				endDaTE: '长期有效',
				tableCard_loading: false,
				formInline5: {
				    pageNum:1,
				    sort:'VOUCHER_AMT',
				    desc:'DESC',
				    pageSize:10,
				    storeId:''
				},
				pageInfo5: {
				    pageNum: 1,
				    pageSize: 1,
				    count: 1,
				    dtos:[]
				},
            }
        },
        created(){
            this.formInline.storeId=this.$route.params.id
            this.formInline2.storeId=this.$route.params.id
			this.formInline4.storeId=this.$route.params.id
			this.formInline5.storeId=this.$route.params.id
			this.formInlinePay.storeId = this.$route.params.id
            this.storeId=this.$route.params.id
            this.selectSort()
            this.fetchData(this.pageInfo.pageNum);
        },
        activated() {
            
        },
        methods: {
			fetchDataPay(page = 1) {
				this.table_loading = true;
				this.pageInfoPay.pageNum = page
				this.formInlinePay.pageNum = this.pageInfoPay.pageNum
				console.log(this.formInlinePay)
				this.dataApi.ajax('selectPagePayStoreVoucher', this.formInlinePay, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfoPay = res
						console.log(res)
					}
				});
			
			},
			handleCurrentChangePay(val) {
				this.fetchDataPay(val)
			},
            fetchData (page = 1) {
                this.table_loading = true;
                this.pageInfo.pageNum = page
                this.formInline.pageNum = this.pageInfo.pageNum
				console.log(this.formInline)
                this.dataApi.ajax('selectPageStoreGood',this.formInline, res => {
                    this.table_loading = false;
                    if (res.responseType === 'S') {
                        this.pageInfo = res
                    }
                });

            },
             fetchData2 (page = 1) {
                this.table_loading = true;
                this.pageInfo2.pageNum = page
                this.formInline2.pageNum = this.pageInfo2.pageNum
				console.log(this.formInline2)
                this.dataApi.ajax('selectPagePayStoreVoucher',this.formInline2, res => {
                    this.table_loading = false;
                    if (res.responseType === 'S'){
                        this.pageInfo2 = res
                    }
                });

            },
            changeType(){
                this.formInline.phone=''
                this.formInline.realName=''
            },
            handleCurrentChange(val) {
               
                if (this.activeName=='1') {
                   this.fetchData(val)
                }
                if (this.activeName=='2') {
                   this.fetchData2(val)
                }          
            },
            handleCurrentChange2(val) {
                this.fetchData3(val)          
            },
            goodDetail(id){
                this.$router.push('/merchant/take_out_detail/' + id)
            },
            voucherDetail(id){
                this.$router.push('/merchant/voucher_detail/' + id)
            },
            order(column){
                if (!column.order) {
                    return;
                }
                 if (column.order=='ascending') {
                     this.formInline.desc='ASC'
                }else{
                    this.formInline.desc='DESC'
                }
                this.formInline.sort=column.prop.toUpperCase()
                this.fetchData(this.pageInfo.pageNum)
            },
            order2(column){
                if (!column.order) {
                    return;
                }
                 if (column.order=='ascending') {
                     this.formInline2.desc='ASC'
                }else{
                    this.formInline2.desc='DESC'
                }
                this.formInline2.sort=column.prop.toUpperCase()
                this.fetchData2(this.pageInfo2.pageNum)
            },
            check(item){
               this.$router.push('/manor/manor_deal/'+item.cityCode+'?cityName='+item.cityName)
            },
            handleClick(tab) {
				this.activeName = tab
                if (this.activeName=='1') {
                   this.fetchData(1)
                }
                if (this.activeName=='2') {
                   this.fetchData2(1)
                }
				if (this.activeName=='3') {
				   this.fetchData4(1)
				}

            },
            selectSort(){
                this.dataApi.ajax('selectGoodCate',{cateState:'1',storeId:this.storeId}, res => {
                    //console.log(res)
                    if (res.responseType === 'S') {
                       this.sortList = res.dtos
                    }
                });

            },
            selectSort2(){
                this.formInline.goodTwoCate = ''
                this.dataApi.ajax('selectGoodCate', {cateId:this.formInline.goodOneCate,cateState:'1',storeId:this.storeId}, res => {
                    //console.log(res)
                    if (res.responseType === 'S') {
                        this.secondList = res.dtos
                    }
                });

            },
             handleDelete(item,type){
                var state=''
                if (item.goodState==2) {
                    state=6
                }else{
                    state=2
                }

                this.$confirm('确认'+type+'?', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                      this.dataApi.ajax('editStoreGood',{
                        storeGoodDto:{
                           goodId:item.goodId,
                           goodState:state,
                           storeId:item.storeId
                         }
                  }, res => {
                            if (res.responseType === 'S') {
                                this.showMsg(type+'成功!')
                                this.fetchData(this.pageInfo.pageNum)
                            }
                        });
                    }).catch(() => {
                              
                    });
            },
             handleDelete2(item,type){
                var state=''
                state=item.voucherStat==1? 2:1
                this.$confirm('确认'+type+'?', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                      this.dataApi.ajax('editPayStoreVoucher',{voucherStat:state,voucherId:item.voucherId}, res => {
                            if (res.responseType === 'S') {
                                this.$message({
                                    type: 'success',
                                    message: type+'成功!'
                                });
                                this.fetchData2(this.pageInfo2.pageNum)
                            }
                        });
                    }).catch(() => {
                              
                    });
            },
            check(id){
                this.id=id
                this.fetchData3(1)
                this.dialogVisible=true
            },
            fetchData3(page = 1) {
                this.table_loading2 = true;
                this.pageInfo3.pageNum = page
                this.dataApi.ajax('selectPageShopEvaluat',{
                    pageNum:this.pageInfo3.pageNum,
                    pageSize:this.pageInfo3.pageSize,
                    sort:'T1.CRE_TIME',
                    desc:'DESC',
                    goodId:this.id,
                    evaluateType:1
                }, res => {
                    this.table_loading2 = false;
                    if (res.responseType === 'S') {
                       this.pageInfo3=res
                    }
                });


            },
             previewImage(src) {
                this.img.is_preview = true;
                this.img.preview_url = `url(${src})`;
                this.img.preview_images = this.images;
                this.img.transform = '';
            },
            hidePreview() {
                this.img.is_preview = false;
                this.img.preview_url = null;
                this.img.image_index = null;
                this.img.preview_images = [];
                this.img.transform = '';
            },
             rotate(){
              if (this.img.transform=='') {
                  this.img.transform='rotate(90deg)'
              }else if (this.img.transform=='rotate(90deg)') {
                  this.img.transform='rotate(180deg)'
              }else if (this.img.transform=='rotate(180deg)') {
                  this.img.transform='rotate(270deg)'
              }else if (this.img.transform=='rotate(270deg)') {
                  this.img.transform=''
              }
            },
			// 会员卡列表
			fetchData4 (page = 1) {
			    this.table_loading = true;
			    this.pageInfo4.pageNum = page
			    this.formInline4.pageNum = this.pageInfo4.pageNum
			    this.dataApi.ajax('selectStoreCardByPage',this.formInline4, res => {
			        this.table_loading = false;
			        if (res.responseType === 'S'){
			            this.pageInfo4 = res
			        }
			    });
			},
			showCardDiog (data) {
				this.dialogFindVipVisible = true
				this.formInlineCard = JSON.parse(JSON.stringify(data))
				if (this.formInlineCard.voucherCover != ''){
					let formInlineCardstr = this.formInlineCard.voucherCover
					let formInlineCardarr = formInlineCardstr.split(',')
					this.formInlineCard.voucherCover = formInlineCardarr
				} else{
					this.formInlineCard.voucherCover = []
				}
				if (this.formInlineCard.logo != ''){
					let logostr = this.formInlineCard.logo
					let logoarr = logostr.split(',')
					this.formInlineCard.logo = logoarr
				} else{
					this.formInlineCard.logo = []
				}
			},
			cardSubmit () {
				if (this.formInlineCard.voucherCover.length < 1 ) {
					this.showMsg('请上传卡片封面', 'warning')
					return false;
				}
				let data = JSON.parse(JSON.stringify(this.formInlineCard))
				var arr2 = data.voucherCover
				var str2 = arr2.join(',');
				data.voucherCover = str2
				var arr3 = data.logo
				var str3 = arr3.join(',');
				data.logo = str3
				this.dataApi.ajax('editPayStoreCard',data, res => {
				    if (res.responseType === 'S'){
						this.$message({
						    type: 'success',
						    message: '编辑成功!'
						});
						this.dialogFindVipVisible = false
						this.fetchData4(1)
				    }
				});
			},
			uploading4(f) {
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			uploading5(f) {
			
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});
			
			},
			handleClose() {
			    this.dialogFindVipVisible = false
				this.dialogVisibleAll = false
				this.dialogVisiblePayHistory = false
			},
			// 会员卡名单
			findCardList () {
				this.fetchData5(1)
			},
			fetchData5 (page = 1) {
			    this.tableCard_loading = true;
			    this.pageInfo5.pageNum = page
			    this.formInline5.pageNum = this.pageInfo5.pageNum
			    this.dataApi.ajax('storeCardUserList',this.formInline5, res => {
			        this.tableCard_loading = false;
					console.log(res)
			        if (res.responseType === 'S'){
			            this.pageInfo5 = res
						this.dialogVisibleAll = true
			        }
			    });
			
			},
			handleCurrentChangeCard (val) {
				this.fetchData5(val)
			},
			handleDelete3(item,type){
			    var state=''
			    state=item.voucherStat==1? 2:1
			    this.$confirm('确认'+type+'?', '提示', {
			          confirmButtonText: '确定',
			          cancelButtonText: '取消',
			          type: 'warning'
			        }).then(() => {
			          this.dataApi.ajax('editPayStoreCard',{voucherStat:state,voucherId:item.voucherId}, res => {
			                if (res.responseType === 'S') {
			                    this.$message({
			                        type: 'success',
			                        message: type+'成功!'
			                    });
			                    this.fetchData4(this.pageInfo4.pageNum)
			                }
			            });
			        }).catch(() => {
			                  
			        });
			},
			findPayCardList() {
				this.fetchDataPay(1)
				this.dialogVisiblePayHistory = true
				console.log('会员卡购买记录')
			}

        }
    }
</script>
